diff --git a/e2e/__tests__/watchModeNoAccess.test.ts b/e2e/__tests__/watchModeNoAccess.test.ts index 9a03c8c5410b..e372e0f12a97 100644 --- a/e2e/__tests__/watchModeNoAccess.test.ts +++ b/e2e/__tests__/watchModeNoAccess.test.ts @@ -9,13 +9,9 @@ import * as os from 'os'; import * as path from 'path'; import * as fs from 'graceful-fs'; -import {skipSuiteOnWindows} from '@jest/test-utils'; import {cleanup, writeFiles} from '../Utils'; import {runContinuous} from '../runJest'; -// Until https://github.com/nodejs/node/issues/33227 is solved somehow -skipSuiteOnWindows(); - const DIR = path.resolve(os.tmpdir(), 'watch_mode_no_access'); const sleep = (time: number) => @@ -47,6 +43,8 @@ afterEach(async () => { } }); +const getOneSecondAfterMs = (ms: number) => ms / 1000 + 1; + test('does not re-run tests when only access time is modified', async () => { setupFiles(); @@ -64,13 +62,21 @@ test('does not re-run tests when only access time is modified', async () => { // Should re-run the test const modulePath = path.join(DIR, 'foo.js'); const stat = fs.lstatSync(modulePath); - fs.utimesSync(modulePath, stat.atime.getTime(), stat.mtime.getTime()); + fs.utimesSync( + modulePath, + getOneSecondAfterMs(stat.atimeMs), + getOneSecondAfterMs(stat.mtimeMs), + ); await testRun.waitUntil(({stderr}) => numberOfTestRuns(stderr) === 2); // Should NOT re-run the test const fakeATime = 1541723621; - fs.utimesSync(modulePath, fakeATime, stat.mtime.getTime()); + fs.utimesSync( + modulePath, + getOneSecondAfterMs(fakeATime), + getOneSecondAfterMs(stat.mtimeMs), + ); await sleep(3000); expect(numberOfTestRuns(testRun.getCurrentOutput().stderr)).toBe(2);