test: convert to ES Module

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
Rifa Achrinza 2024-02-26 21:27:44 +08:00
parent bb12eaf372
commit 4528459de5
1 changed files with 11 additions and 10 deletions

View File

@ -5,13 +5,15 @@
'use strict'; 'use strict';
const cloneAllProperties = require('../lib/clone.js'); import cloneAllProperties from '../lib/clone.js';
const debug = require('debug')('test'); import debugFactory from 'debug';
const expect = require('chai').expect; import express from 'express';
const express = require('express'); import strongErrorHandler from '../lib/handler.js';
const strongErrorHandler = require('..'); import supertest from 'supertest';
const supertest = require('supertest'); import util from 'node:util';
const util = require('util'); import {expect} from 'chai';
const debug = debugFactory('test');
describe('strong-error-handler', function() { describe('strong-error-handler', function() {
before(setupHttpServerAndClient); before(setupHttpServerAndClient);
@ -137,8 +139,7 @@ describe('strong-error-handler', function() {
// the error name & message // the error name & message
expect(msg).to.contain('TypeError: ERROR-NAME'); expect(msg).to.contain('TypeError: ERROR-NAME');
// the stack // the stack
expect(msg).to.contain(__filename); expect(msg).to.contain(import.meta.url);
done(); done();
}); });
}); });
@ -161,7 +162,7 @@ describe('strong-error-handler', function() {
expect(msg).to.contain('TypeError: ERR1'); expect(msg).to.contain('TypeError: ERR1');
expect(msg).to.contain('Error: ERR2'); expect(msg).to.contain('Error: ERR2');
// verify that stacks are included too // verify that stacks are included too
expect(msg).to.contain(__filename); expect(msg).to.contain(import.meta.url);
done(); done();
}); });