-
-
Notifications
You must be signed in to change notification settings - Fork 751
Expand file tree
/
Copy pathinit_test.js
More file actions
66 lines (56 loc) · 2.02 KB
/
init_test.js
File metadata and controls
66 lines (56 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import * as chai from 'chai'
chai.should()
import path from 'path'
import fs from 'fs'
import { mkdirp } from 'mkdirp'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const codecept_dir = path.join(__dirname, '/../data/sandbox/configs/init')
describe('Init Command', function () {
this.timeout(20000)
beforeEach(() => {
mkdirp.sync(codecept_dir)
process.env._INIT_DRY_RUN_INSTALL = true
})
afterEach(() => {
try {
fs.unlinkSync(`${codecept_dir}/codecept.conf.ts`)
fs.unlinkSync(`${codecept_dir}/steps_file.ts`)
fs.unlinkSync(`${codecept_dir}/tsconfig.json`)
} catch (e) {
// continue regardless of error
}
try {
fs.unlinkSync(`${codecept_dir}/codecept.conf.js`)
fs.unlinkSync(`${codecept_dir}/steps_file.js`)
fs.unlinkSync(`${codecept_dir}/jsconfig.json`)
} catch (e) {
// continue regardless of error
}
delete process.env._INIT_DRY_RUN_INSTALL
})
it('should have init command available and noTranslation defined', async () => {
const { default: initCommand } = await import('../../lib/command/init.js')
initCommand.should.be.a('function')
})
it('should be able to import translations', async () => {
const translationsModule = await import('../../translations/index.js')
const translations = Object.keys(translationsModule.default || translationsModule)
translations.should.be.an('array')
translations.length.should.be.greaterThan(0)
})
// Test the fix for noTranslation bug
it('should have noTranslation constant available in init command', async () => {
// This test verifies that the noTranslation bug is fixed
// by importing the module and checking no syntax errors occur
try {
await import('../../lib/command/init.js')
} catch (error) {
if (error.message.includes('noTranslation is not defined')) {
throw new Error('noTranslation bug still exists in init command')
}
throw error
}
})
})