Skip to content

Commit

Permalink
ci: add Node 20 to test matrix (#484)
Browse files Browse the repository at this point in the history
and strip colors from Node output during test
  • Loading branch information
AviVahl authored Jul 7, 2023
1 parent 8a7efb1 commit f98e8a1
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18, 16]
node-version: [20, 18, 16]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
Expand Down
103 changes: 37 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.1",
"strip-ansi": "^7.1.0",
"typescript": "~5.1.6",
"webpack": "^5.88.1"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/esm/src/test/esm-loader.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { describe, it } from 'node:test';
import { equal, notEqual, ok } from 'node:assert/strict';
import { dirname, join, sep } from 'node:path';
import { platform } from 'node:os';
import { spawnSync } from 'node:child_process';
import { createRequire } from 'node:module';
import { platform } from 'node:os';
import { dirname, join, sep } from 'node:path';
import stripAnsi from 'strip-ansi';

const require = createRequire(import.meta.url);
const fixturesRoot = dirname(require.resolve('@ts-tools/fixtures/package.json'));

export function runCommand(command: string): { output: string; exitCode: number } {
const [execName, ...args] = command.split(' ');
const { output, status: exitCode } = spawnSync(execName!, args);
return { output: output.join('\n'), exitCode: exitCode || 0 };
return { output: stripAnsi(output.join('\n')), exitCode: exitCode || 0 };
}

describe('using node --loader @ts-tools/esm <file>', { timeout: 5_000 }, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { describe, it } from 'node:test';
import { equal, notEqual, ok } from 'node:assert/strict';
import { join, sep, dirname } from 'node:path';
import { platform } from 'node:os';
import { spawnSync } from 'node:child_process';
import { createRequire } from 'node:module';
import { platform } from 'node:os';
import { dirname, join, sep } from 'node:path';
import stripAnsi from 'strip-ansi';

const require = createRequire(import.meta.url);
const fixturesRoot = dirname(require.resolve('@ts-tools/fixtures/package.json'));

export function runCommand(command: string): { output: string; exitCode: number } {
const [execName, ...args] = command.split(' ');
const { output, status: exitCode } = spawnSync(execName!, args);
return { output: output.join('\n'), exitCode: exitCode || 0 };
return { output: stripAnsi(output.join('\n')), exitCode: exitCode || 0 };
}

describe('using node -r @ts-tools/node/r <file>', { timeout: 5_000 }, () => {
Expand Down

0 comments on commit f98e8a1

Please sign in to comment.