Skip to content

Commit b0644ae

Browse files
committed
Fix unit test for windows + make more strict
1 parent 172676c commit b0644ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

detox/src/utils/tempfile.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ describe('tempfile', () => {
99
});
1010

1111
it('should work with the real tmp module', () => {
12+
const tmpdir = require('node:os').tmpdir();
13+
const path = require('node:path');
14+
15+
const expectedFile = path.join(tmpdir, `detox-${process.pid}-[a-zA-Z0-9]+.log`).replace(/\\/g, '\\\\');
16+
const expectedResult = new RegExp(`^${expectedFile}$`);
17+
1218
const result = tempfile('.log');
13-
expect(result).toMatch(new RegExp(`^/var[/\\\\].*/detox-${process.pid}-[a-zA-Z0-9]+\\.log$`));
19+
expect(result).toMatch(expectedResult);
1420
});
1521
});
1622

0 commit comments

Comments
 (0)