Skip to content

Commit

Permalink
fix or ignore with a comment windows tests and run tests on Windows a…
Browse files Browse the repository at this point in the history
…nd MacOS on CI
  • Loading branch information
vzaidman committed Oct 17, 2024
1 parent c8c0572 commit 073914f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: ['ubuntu-latest']
runs-on: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node-version: [
'18.18.0', # minimum supported
'lts/-1', # pre-latest lts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
max-parallel: 1 # reduces the flakiness of these tests
fail-fast: false
matrix:
runs-on: ['ubuntu-latest']
runs-on: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node-version: [ # https://github.com/nodejs/release#release-schedule
'18.18.0', # minimum supported
'lts/-1', # pre-latest lts
Expand Down
44 changes: 44 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,50 @@ if (process.env.NIGHTLY_TESTS_NO_LOCKFILE) {
testPathIgnorePatterns.push('__tests__/babel-lib-defs-test.js');
}

if (process.platform === 'win32') {
// TODO: fix on windows
testPathIgnorePatterns.push(
...[
// path mismatches
'packages/metro/src/__tests__/HmrServer-test.js',
'packages/metro/src/DeltaBundler/__tests__/buildSubgraph-test.js',
'packages/metro/src/DeltaBundler/__tests__/Graph-test.js',
'packages/metro/src/DeltaBundler/Serializers/helpers/__tests__/js-test.js',
'packages/metro/src/node-haste/lib/__tests__/AssetPaths-test.js',
'packages/metro/src/Server/__tests__/Server-test.js',
'packages/metro-config/src/__tests__/loadConfig-test.js',
'packages/metro-symbolicate/src/__tests__/symbolicate-test.js',
'packages/metro-file-map/src/__tests__/index-test.js',
'packages/metro-file-map/src/watchers/__tests__/WatchmanWatcher-test.js',
'packages/metro-file-map/src/crawlers/__tests__/node-test.js',
'packages/metro-file-map/src/watchers/__tests__/integration-test.js',

// resolveModulePath failed
'packages/metro-cache/src/stores/__tests__/FileStore-test.js',
'packages/metro-resolver/src/__tests__/assets-test.js',
'packages/metro-resolver/src/__tests__/platform-extensions-test.js',
'packages/metro-resolver/src/__tests__/symlinks-test.js',

// const {_cwd} = this; resolution issue in `metro-memory-fs/src/index.js:1294:15`
'packages/metro/src/__tests__/Assets-test.js',
'packages/metro/src/DeltaBundler/__tests__/resolver-test.js',
'packages/buck-worker-tool/src/__tests__/worker-test.js',
'packages/metro-transform-worker/src/__tests__/index-test.js',
'packages/metro-cache/src/stores/__tests__/AutoCleanFileStore-test.js',
'packages/metro-cache/src/stores/__tests__/FileStore-test.js',

// endless loading
'packages/metro-resolver/src/__tests__/browser-spec-test.js',
'packages/metro-resolver/src/__tests__/package-exports-test.js',
'packages/metro-resolver/src/__tests__/index-test.js',

// unclear issue
'packages/metro/src/DeltaBundler/__tests__/DeltaCalculator-test.js',
'packages/metro-file-map/src/crawlers/__tests__/integration-test.js',
],
);
}

/** @type {import('jest').Config} **/
module.exports = {
modulePathIgnorePatterns: ['/node_modules/', 'packages/[^/]+/build/'],
Expand Down
6 changes: 3 additions & 3 deletions packages/metro/src/integration_tests/__tests__/server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ describe('Metro development server serves bundles via HTTP', () => {
const bundlesDownloaded = new Set();
let serverClosedPromise;

async function downloadAndExec(path: string, context = {}): mixed {
async function downloadAndExec(pathname: string, context = {}): mixed {
const response = await fetchAndClose(
'http://localhost:' + config.server.port + path,
'http://localhost:' + config.server.port + pathname,
);
bundlesDownloaded.add(path);
bundlesDownloaded.add(pathname.replaceAll('\\', '/'));

const body = await response.text();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jest.unmock('cosmiconfig');

jest.useRealTimers();

jest.setTimeout(10000);

describe('Server torn down test', () => {
const active = new Map();
const hook = asyncHooks.createHook({
Expand Down

0 comments on commit 073914f

Please sign in to comment.