mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
fix(node): run tests with native ESM modules instead of esm (#5194)
close #5156 --------- Co-authored-by: Septias <scoreplayer2000@gmail.comclear>
This commit is contained in:
@@ -178,7 +178,7 @@ export class AccountManager extends EventEmitter {
|
|||||||
static newTemporary() {
|
static newTemporary() {
|
||||||
let directory = null
|
let directory = null
|
||||||
while (true) {
|
while (true) {
|
||||||
const randomString = Math.random().toString(36).substr(2, 5)
|
const randomString = Math.random().toString(36).substring(2, 5)
|
||||||
directory = join(tmpdir(), 'deltachat-' + randomString)
|
directory = join(tmpdir(), 'deltachat-' + randomString)
|
||||||
if (!existsSync(directory)) break
|
if (!existsSync(directory)) break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
import DeltaChat from '../dist'
|
import { DeltaChat } from '../dist/index.js'
|
||||||
|
|
||||||
import { deepStrictEqual, strictEqual } from 'assert'
|
import { deepStrictEqual, strictEqual } from 'assert'
|
||||||
import chai, { expect } from 'chai'
|
import chai, { expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { EventId2EventName, C } from '../dist/constants'
|
import { EventId2EventName, C } from '../dist/constants.js'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { statSync } from 'fs'
|
import { statSync } from 'fs'
|
||||||
import { Context } from '../dist/context'
|
import { Context } from '../dist/context.js'
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
chai.use(chaiAsPromised)
|
chai.use(chaiAsPromised)
|
||||||
chai.config.truncateThreshold = 0 // Do not truncate assertion errors.
|
chai.config.truncateThreshold = 0 // Do not truncate assertion errors.
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
"@types/node": "^20.8.10",
|
"@types/node": "^20.8.10",
|
||||||
"chai": "~4.3.10",
|
"chai": "~4.3.10",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"esm": "^3.2.25",
|
|
||||||
"mocha": "^8.2.1",
|
"mocha": "^8.2.1",
|
||||||
"node-gyp": "^10.0.0",
|
"node-gyp": "^10.0.0",
|
||||||
"prebuildify": "^5.0.1",
|
"prebuildify": "^5.0.1",
|
||||||
@@ -53,7 +52,7 @@
|
|||||||
"prebuildify": "cd node && prebuildify -t 18.0.0 --napi --strip --postinstall \"node scripts/postinstall.js --prebuild\"",
|
"prebuildify": "cd node && prebuildify -t 18.0.0 --napi --strip --postinstall \"node scripts/postinstall.js --prebuild\"",
|
||||||
"test": "npm run test:lint && npm run test:mocha",
|
"test": "npm run test:lint && npm run test:mocha",
|
||||||
"test:lint": "npm run lint",
|
"test:lint": "npm run lint",
|
||||||
"test:mocha": "mocha -r esm node/test/test.js --growl --reporter=spec --bail --exit"
|
"test:mocha": "mocha node/test/test.mjs --growl --reporter=spec --bail --exit"
|
||||||
},
|
},
|
||||||
"types": "node/dist/index.d.ts",
|
"types": "node/dist/index.d.ts",
|
||||||
"version": "1.133.0"
|
"version": "1.133.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user