Skip to content

Commit 77e15a9

Browse files
authored
test: correct execution of test and dev scripts on Windows machines (typescript-eslint#4926)
1 parent 1fc4e76 commit 77e15a9

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

packages/types/tools/copy-ast-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ async function execAsync(
1515
return new Promise((resolve, reject) => {
1616
const child = childProcess.spawn(command, args, {
1717
...options,
18+
shell: process.platform === 'win32',
1819
stdio: 'inherit',
1920
});
2021

packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ class FixturesTester {
9292
return this.fixtures
9393
.map(fixture =>
9494
glob
95-
.sync(`${fixture.directory}/${fixture.pattern}`, {})
95+
.sync(fixture.pattern, {
96+
cwd: fixture.directory,
97+
absolute: true,
98+
})
9699
.map(filename => ({
97100
filename,
98101
ignoreSourceType: fixture.ignoreSourceType,
@@ -346,7 +349,6 @@ tester.addFixturePatternConfig('typescript/basics', {
346349
/**
347350
* Not yet supported in Babel
348351
* Directive field is not added to module and namespace
349-
* @see https://github.com/babel/babel/issues/9228
350352
*/
351353
'directive-in-module',
352354
'directive-in-namespace',

packages/typescript-estree/tests/ast-fixtures.test.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ addSerializer(serializer);
1515
// prettier-ignore
1616
const ONLY = [].join(path.sep);
1717

18-
const FIXTURES_DIR = path.resolve(
18+
const fixturesDir = path.resolve(
1919
__dirname,
2020
'..',
2121
'..',
@@ -25,15 +25,15 @@ const FIXTURES_DIR = path.resolve(
2525
'shared-fixtures',
2626
'fixtures',
2727
);
28-
const SNAPSHOTS_DIR = path.resolve(__dirname, 'snapshots');
28+
const snapshotsDir = path.resolve(__dirname, 'snapshots');
2929

3030
const fixtures = glob
31-
.sync(`${FIXTURES_DIR}/**/*.src.{js,ts,jsx,tsx}`)
31+
.sync(`**/*.src.{js,ts,jsx,tsx}`, { cwd: fixturesDir, absolute: true })
3232
.map(absolute => {
33-
const relative = path.relative(FIXTURES_DIR, absolute);
33+
const relative = path.relative(fixturesDir, absolute);
3434
const { name, dir, ext } = path.parse(relative);
3535
const segments = dir.split(path.sep);
36-
const snapshotPath = path.join(SNAPSHOTS_DIR, dir);
36+
const snapshotPath = path.join(snapshotsDir, dir);
3737
return {
3838
absolute,
3939
isJsx: isJSXFileType(ext),
@@ -97,14 +97,16 @@ fixtures.forEach(f => nestDescribe(f));
9797

9898
if (ONLY === '') {
9999
// ensure that the snapshots are cleaned up, because jest-specific-snapshot won't do this check
100-
const snapshots = glob.sync(`${SNAPSHOTS_DIR}/**/*.shot`).map(absolute => {
101-
const relative = path.relative(SNAPSHOTS_DIR, absolute);
102-
const { name, dir } = path.parse(relative);
103-
return {
104-
relative,
105-
fixturePath: path.join(FIXTURES_DIR, dir, name),
106-
};
107-
});
100+
const snapshots = glob
101+
.sync(`**/*.shot`, { cwd: snapshotsDir, absolute: true })
102+
.map(absolute => {
103+
const relative = path.relative(snapshotsDir, absolute);
104+
const { name, dir } = path.parse(relative);
105+
return {
106+
relative,
107+
fixturePath: path.join(fixturesDir, dir, name),
108+
};
109+
});
108110

109111
describe('ast snapshots should have an associated test', () => {
110112
for (const snap of snapshots) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy