Skip to content

Commit 9f4ce46

Browse files
committed
fix uts
1 parent f6c1403 commit 9f4ce46

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

lib/translation.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ class Translation {
1616

1717
loadVocabulary(vocabularyFile) {
1818
if (!vocabularyFile) return
19-
const filePath = path.join(store.codeceptDir, vocabularyFile)
19+
20+
let filePath;
21+
if (path.isAbsolute(vocabularyFile)) {
22+
filePath = vocabularyFile;
23+
} else {
24+
filePath = path.join(store.codeceptDir, vocabularyFile);
25+
}
2026

2127
try {
2228
const require = createRequire(import.meta.url)

test/unit/container_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { resolveImportModulePath } from '../../lib/utils.js'
1414
const realDummyPagePath = path.resolve(__dirname, '../data/dummy_page.js');
1515
const realIPath = path.resolve(__dirname, '../data/I.js');
1616
const realHelperPath = path.resolve(__dirname, '../data/helper.js');
17+
const realVocabulariesPath = path.resolve(__dirname, '../data/custom_vocabulary.json');
1718

1819
describe('Container', () => {
1920
before(() => {
@@ -82,7 +83,7 @@ describe('Container', () => {
8283
})
8384

8485
it('should load custom translation with vocabularies', async () => {
85-
await container.create({ translation: 'my', vocabularies: ['data/custom_vocabulary.json'] })
86+
await container.create({ translation: 'my', vocabularies: [realVocabulariesPath] })
8687
expect(container.translation()).to.be.instanceOf(Translation)
8788
expect(container.translation().loaded).to.be.true
8889
const translation = container.translation()

0 commit comments

Comments
 (0)