Skip to content

Commit 555d34c

Browse files
committed
fix path issues on test
1 parent 61c6865 commit 555d34c

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
env:
7373
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
7474
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
75-
- run: npm run test:unit
75+
- run: npm run test:unit:windows
7676

7777
runner-tests:
7878
name: Runner tests

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"prettier": "prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js runok.cjs",
6565
"docs": "./runok.cjs docs",
6666
"test:unit": "mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
67+
"test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
6768
"test:rest": "mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha",
6869
"test:runner": "mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
6970
"test": "npm run test:unit && npm run test:rest && npm run test:runner",

test/unit/container_test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai'
22
import path from 'path'
3-
import { fileURLToPath } from 'url'
3+
import { fileURLToPath, pathToFileURL } from 'url'
44

55
const __filename = fileURLToPath(import.meta.url)
66
const __dirname = path.dirname(__filename)
@@ -9,6 +9,7 @@ import FileSystem from '../../lib/helper/FileSystem.js'
99
import actor from '../../lib/actor.js'
1010
import container from '../../lib/container.js'
1111
import Translation from '../../lib/translation.js'
12+
import { isWindows } from '../../lib/utils.js'
1213

1314
describe('Container', () => {
1415
before(() => {
@@ -183,7 +184,7 @@ describe('Container', () => {
183184
dummyPage: './data/dummy_page.js',
184185
},
185186
})
186-
const dummyPage = await import('../data/dummy_page.js')
187+
const dummyPage = isWindows() ? await import(pathToFileURL('../data/dummy_page.js').href) : await import('../data/dummy_page.js')
187188
expect(container.support('dummyPage').toString()).is.eql((dummyPage.default || dummyPage).toString())
188189
})
189190

0 commit comments

Comments
 (0)