|
1 | | -import { expect } from 'chai'; |
| 1 | +import { describe, it, after } from 'node:test'; |
| 2 | +import assert from 'node:assert/strict'; |
2 | 3 | import { promises as fs } from 'fs'; |
3 | 4 | import path from 'path'; |
4 | 5 | import globby from 'globby'; |
5 | 6 |
|
6 | 7 | import { chromeLauncher } from '@web/test-runner-chrome'; |
7 | | -import { TestRunnerCoreConfig } from '@web/test-runner-core'; |
| 8 | +import type { TestRunnerCoreConfig } from '@web/test-runner-core'; |
8 | 9 | import { runTests } from '@web/test-runner-core/test-helpers'; |
9 | | -import { junitReporter } from '../src/junitReporter.js'; |
| 10 | +import { junitReporter } from '../dist/junitReporter.js'; |
10 | 11 |
|
11 | 12 | const NON_ZERO_TIME_VALUE_REGEX = /time="((\d\.\d+)|(\d))"/g; |
12 | 13 |
|
13 | 14 | const USER_AGENT_STRING_REGEX = /"Mozilla\/5\.0 (.*)"/g; |
14 | 15 |
|
15 | | -const rootDir = path.join(__dirname, '..', '..', '..'); |
| 16 | +const rootDir = path.resolve(import.meta.dirname, '..', '..', '..'); |
16 | 17 |
|
17 | 18 | const normalizeOutput = (cwd: string, output: string) => |
18 | 19 | output |
@@ -64,35 +65,35 @@ async function run(cwd: string): Promise<{ actual: string; expected: string }> { |
64 | 65 | async function cleanupFixtures() { |
65 | 66 | for (const file of await globby('fixtures/**/test-results.xml', { |
66 | 67 | absolute: true, |
67 | | - cwd: __dirname, |
| 68 | + cwd: import.meta.dirname, |
68 | 69 | })) |
69 | 70 | await fs.unlink(file); |
70 | 71 | } |
71 | 72 |
|
72 | | -describe('junitReporter', function () { |
| 73 | +describe('junitReporter', () => { |
73 | 74 | after(cleanupFixtures); |
74 | 75 |
|
75 | | - describe('for a simple case', function () { |
76 | | - const fixtureDir = path.join(__dirname, 'fixtures/simple'); |
77 | | - it('produces expected results', async function () { |
| 76 | + describe('for a simple case', () => { |
| 77 | + const fixtureDir = path.join(import.meta.dirname, 'fixtures/simple'); |
| 78 | + it('produces expected results', async () => { |
78 | 79 | const { actual, expected } = await run(fixtureDir); |
79 | | - expect(actual).to.equal(expected); |
| 80 | + assert.equal(actual, expected); |
80 | 81 | }); |
81 | 82 | }); |
82 | 83 |
|
83 | | - describe('for a nested suite', function () { |
84 | | - const fixtureDir = path.join(__dirname, 'fixtures/nested'); |
85 | | - it('produces expected results', async function () { |
| 84 | + describe('for a nested suite', () => { |
| 85 | + const fixtureDir = path.join(import.meta.dirname, 'fixtures/nested'); |
| 86 | + it('produces expected results', async () => { |
86 | 87 | const { actual, expected } = await run(fixtureDir); |
87 | | - expect(actual).to.equal(expected); |
| 88 | + assert.equal(actual, expected); |
88 | 89 | }); |
89 | 90 | }); |
90 | 91 |
|
91 | | - describe('for multiple test files', function () { |
92 | | - const fixtureDir = path.join(__dirname, 'fixtures/multiple'); |
93 | | - it('produces expected results', async function () { |
| 92 | + describe('for multiple test files', () => { |
| 93 | + const fixtureDir = path.join(import.meta.dirname, 'fixtures/multiple'); |
| 94 | + it('produces expected results', async () => { |
94 | 95 | const { actual, expected } = await run(fixtureDir); |
95 | | - expect(actual).to.equal(expected); |
| 96 | + assert.equal(actual, expected); |
96 | 97 | }); |
97 | 98 | }); |
98 | 99 | }); |
0 commit comments