Skip to content

Commit

Permalink
fix(tests): Allow tests to run on Windows without WSL (#3813)
Browse files Browse the repository at this point in the history
A few changes to make the test suite fully cross platform
  • Loading branch information
timfish authored Aug 5, 2021
1 parent 5bba9b4 commit 1317b9e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
2 changes: 1 addition & 1 deletion packages/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint . --cache --cache-location '../../eslintcache/'",
"start": "ember serve",
"test": "bash ./scripts/run_tests.sh",
"test": "node ./scripts/run_tests.js",
"test:ember": "ember test",
"test:ember-compatibility": "ember try:each",
"prepublishOnly": "ember ts:precompile",
Expand Down
15 changes: 15 additions & 0 deletions packages/ember/scripts/run_tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// running compatibilty tests takes ~15 min on a 2019 2.6 GHz 6-Core Intel i7 16" MacBook Pro w 32 GB of RAM, vs ~25 sec
// for the regular tests

/*eslint-env node*/
const { spawnSync } = require('child_process');

if (process.env.TRAVIS || process.env.GITHUB_ACTIONS) {
console.log('In CI - running tests against multiple versions of Ember');
const result = spawnSync('yarn npm-run-all lint:* test:*', { shell: true, stdio: 'inherit' });
process.exit(result.status);
} else {
console.log('Tests running locally - will only run tests against default version of Ember');
const result = spawnSync('yarn npm-run-all lint:* test:ember', { shell: true, stdio: 'inherit' });
process.exit(result.status);
}
10 changes: 0 additions & 10 deletions packages/ember/scripts/run_tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion packages/node/test/manual/release-health/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ for (const dir of scenariosDirs) {

const processes = scenarios.map(([filename, filepath]) => {
return new Promise(resolve => {
const scenarioProcess = spawn('/usr/bin/env', ['node', filepath]);
const scenarioProcess = spawn('node', [filepath]);
const output = [];
const errors = [];

Expand Down
34 changes: 17 additions & 17 deletions packages/node/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import { deepReadDirSync } from '../src/utils';

describe('deepReadDirSync', () => {
it('handles nested files', () => {
const expected = [
// root level
'debra.txt',
// one level deep
'cats/eddy.txt',
'cats/persephone.txt',
'cats/piper.txt',
'cats/sassafras.txt',
'cats/teaberry.txt',
// two levels deep
'dogs/theBigs/charlie.txt',
'dogs/theBigs/maisey.txt',
'dogs/theSmalls/bodhi.txt',
'dogs/theSmalls/cory.txt',
].map(p => (process.platform === 'win32' ? p.replace(/\//g, '\\') : p));

// compare sets so that order doesn't matter
expect(new Set(deepReadDirSync('./test/fixtures/testDeepReadDirSync'))).toEqual(
new Set([
// root level
'debra.txt',
// one level deep
'cats/eddy.txt',
'cats/persephone.txt',
'cats/piper.txt',
'cats/sassafras.txt',
'cats/teaberry.txt',
// two levels deep
'dogs/theBigs/charlie.txt',
'dogs/theBigs/maisey.txt',
'dogs/theSmalls/bodhi.txt',
'dogs/theSmalls/cory.txt',
]),
);
expect(new Set(deepReadDirSync('./test/fixtures/testDeepReadDirSync'))).toEqual(new Set(expected));
});

it('handles empty target directory', (done: (error?: Error) => void) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@sentry-internal/eslint-config-sdk": "6.10.0",
"@types/jest-environment-puppeteer": "^4.4.0",
"@types/puppeteer": "^5.4.0",
"cross-env":"^7.0.3",
"express": "^4.17.1",
"jest": "^24.7.1",
"jest-puppeteer": "^4.4.0",
Expand Down Expand Up @@ -54,7 +55,7 @@
"fix": "run-s fix:eslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
"fix:eslint": "eslint . --format stylish --fix",
"test": "PORT=1337 jest",
"test": "cross-env PORT=1337 jest",
"test:watch": "jest --watch",
"pack": "npm pack",
"circularDepCheck": "madge --circular src/index.ts"
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7266,6 +7266,13 @@ create-react-context@^0.2.2:
fbjs "^0.8.0"
gud "^1.0.0"

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
Expand All @@ -7277,7 +7284,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.0, cross-spawn@^7.0.2:
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down

0 comments on commit 1317b9e

Please sign in to comment.