diff --git a/packages/types/tools/copy-ast-spec.ts b/packages/types/tools/copy-ast-spec.ts index 8b7848d9a71..7e4eff420c9 100644 --- a/packages/types/tools/copy-ast-spec.ts +++ b/packages/types/tools/copy-ast-spec.ts @@ -15,6 +15,7 @@ async function execAsync( return new Promise((resolve, reject) => { const child = childProcess.spawn(command, args, { ...options, + shell: process.platform === 'win32', stdio: 'inherit', }); diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 5c3900f5ba8..5f44161557c 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -92,7 +92,10 @@ class FixturesTester { return this.fixtures .map(fixture => glob - .sync(`${fixture.directory}/${fixture.pattern}`, {}) + .sync(fixture.pattern, { + cwd: fixture.directory, + absolute: true, + }) .map(filename => ({ filename, ignoreSourceType: fixture.ignoreSourceType, @@ -346,7 +349,6 @@ tester.addFixturePatternConfig('typescript/basics', { /** * Not yet supported in Babel * Directive field is not added to module and namespace - * @see https://github.com/babel/babel/issues/9228 */ 'directive-in-module', 'directive-in-namespace', diff --git a/packages/typescript-estree/tests/ast-fixtures.test.ts b/packages/typescript-estree/tests/ast-fixtures.test.ts index f3ffbabd809..37a7e5cb71f 100644 --- a/packages/typescript-estree/tests/ast-fixtures.test.ts +++ b/packages/typescript-estree/tests/ast-fixtures.test.ts @@ -15,7 +15,7 @@ addSerializer(serializer); // prettier-ignore const ONLY = [].join(path.sep); -const FIXTURES_DIR = path.resolve( +const fixturesDir = path.resolve( __dirname, '..', '..', @@ -25,15 +25,15 @@ const FIXTURES_DIR = path.resolve( 'shared-fixtures', 'fixtures', ); -const SNAPSHOTS_DIR = path.resolve(__dirname, 'snapshots'); +const snapshotsDir = path.resolve(__dirname, 'snapshots'); const fixtures = glob - .sync(`${FIXTURES_DIR}/**/*.src.{js,ts,jsx,tsx}`) + .sync(`**/*.src.{js,ts,jsx,tsx}`, { cwd: fixturesDir, absolute: true }) .map(absolute => { - const relative = path.relative(FIXTURES_DIR, absolute); + const relative = path.relative(fixturesDir, absolute); const { name, dir, ext } = path.parse(relative); const segments = dir.split(path.sep); - const snapshotPath = path.join(SNAPSHOTS_DIR, dir); + const snapshotPath = path.join(snapshotsDir, dir); return { absolute, isJsx: isJSXFileType(ext), @@ -97,14 +97,16 @@ fixtures.forEach(f => nestDescribe(f)); if (ONLY === '') { // ensure that the snapshots are cleaned up, because jest-specific-snapshot won't do this check - const snapshots = glob.sync(`${SNAPSHOTS_DIR}/**/*.shot`).map(absolute => { - const relative = path.relative(SNAPSHOTS_DIR, absolute); - const { name, dir } = path.parse(relative); - return { - relative, - fixturePath: path.join(FIXTURES_DIR, dir, name), - }; - }); + const snapshots = glob + .sync(`**/*.shot`, { cwd: snapshotsDir, absolute: true }) + .map(absolute => { + const relative = path.relative(snapshotsDir, absolute); + const { name, dir } = path.parse(relative); + return { + relative, + fixturePath: path.join(fixturesDir, dir, name), + }; + }); describe('ast snapshots should have an associated test', () => { for (const snap of snapshots) {