|
6 | 6 | TEST_DIR,
|
7 | 7 | tsNodeTypes,
|
8 | 8 | } from './helpers';
|
9 |
| -import { context } from './testlib'; |
10 |
| -import { expect } from 'chai'; |
| 9 | +import { context, expect } from './testlib'; |
11 | 10 | import * as exp from 'expect';
|
12 | 11 | import { join, resolve } from 'path';
|
13 | 12 | import proxyquire = require('proxyquire');
|
@@ -74,51 +73,51 @@ test.suite('register(create(options))', (test) => {
|
74 | 73 | }) => {
|
75 | 74 | const m = require(moduleTestPath);
|
76 | 75 |
|
77 |
| - expect(m.example('foo')).to.equal('FOO'); |
| 76 | + expect(m.example('foo')).toBe('FOO'); |
78 | 77 | });
|
79 | 78 |
|
80 | 79 | test('should support dynamically disabling', ({
|
81 | 80 | context: { service, moduleTestPath },
|
82 | 81 | }) => {
|
83 | 82 | delete require.cache[moduleTestPath];
|
84 | 83 |
|
85 |
| - expect(service.enabled(false)).to.equal(false); |
86 |
| - expect(() => require(moduleTestPath)).to.throw(/Unexpected token/); |
| 84 | + expect(service.enabled(false)).toBe(false); |
| 85 | + expect(() => require(moduleTestPath)).toThrow(/Unexpected token/); |
87 | 86 |
|
88 | 87 | delete require.cache[moduleTestPath];
|
89 | 88 |
|
90 |
| - expect(service.enabled()).to.equal(false); |
91 |
| - expect(() => require(moduleTestPath)).to.throw(/Unexpected token/); |
| 89 | + expect(service.enabled()).toBe(false); |
| 90 | + expect(() => require(moduleTestPath)).toThrow(/Unexpected token/); |
92 | 91 |
|
93 | 92 | delete require.cache[moduleTestPath];
|
94 | 93 |
|
95 |
| - expect(service.enabled(true)).to.equal(true); |
96 |
| - expect(() => require(moduleTestPath)).to.not.throw(); |
| 94 | + expect(service.enabled(true)).toBe(true); |
| 95 | + expect(() => require(moduleTestPath)).not.toThrow(); |
97 | 96 |
|
98 | 97 | delete require.cache[moduleTestPath];
|
99 | 98 |
|
100 |
| - expect(service.enabled()).to.equal(true); |
101 |
| - expect(() => require(moduleTestPath)).to.not.throw(); |
| 99 | + expect(service.enabled()).toBe(true); |
| 100 | + expect(() => require(moduleTestPath)).not.toThrow(); |
102 | 101 | });
|
103 | 102 |
|
104 | 103 | test('should compile through js and ts', () => {
|
105 | 104 | const m = require('../../tests/complex');
|
106 | 105 |
|
107 |
| - expect(m.example()).to.equal('example'); |
| 106 | + expect(m.example()).toBe('example'); |
108 | 107 | });
|
109 | 108 |
|
110 | 109 | test('should work with proxyquire', () => {
|
111 | 110 | const m = proxyquire('../../tests/complex', {
|
112 | 111 | './example': 'hello',
|
113 | 112 | });
|
114 | 113 |
|
115 |
| - expect(m.example()).to.equal('hello'); |
| 114 | + expect(m.example()).toBe('hello'); |
116 | 115 | });
|
117 | 116 |
|
118 | 117 | test('should work with `require.cache`', () => {
|
119 | 118 | const { example1, example2 } = require('../../tests/require-cache');
|
120 | 119 |
|
121 |
| - expect(example1).to.not.equal(example2); |
| 120 | + expect(example1).not.toBe(example2); |
122 | 121 | });
|
123 | 122 |
|
124 | 123 | test('should use source maps', async () => {
|
@@ -155,10 +154,10 @@ test.suite('register(create(options))', (test) => {
|
155 | 154 | try {
|
156 | 155 | require('../../tests/with-jsx.tsx');
|
157 | 156 | } catch (error: any) {
|
158 |
| - expect(error.stack).to.contain('SyntaxError: Unexpected token'); |
| 157 | + expect(error.stack).toMatch('SyntaxError: Unexpected token'); |
159 | 158 | }
|
160 | 159 |
|
161 |
| - expect(compiled).to.match(SOURCE_MAP_REGEXP); |
| 160 | + expect(compiled).toMatch(SOURCE_MAP_REGEXP); |
162 | 161 | });
|
163 | 162 | });
|
164 | 163 | });
|
@@ -190,18 +189,18 @@ test('should support compiler scopes w/multiple registered compiler services at
|
190 | 189 | });
|
191 | 190 |
|
192 | 191 | try {
|
193 |
| - expect(require('../../tests/scope/a').ext).to.equal('.ts'); |
194 |
| - expect(require('../../tests/scope/b').ext).to.equal('.ts'); |
| 192 | + expect(require('../../tests/scope/a').ext).toBe('.ts'); |
| 193 | + expect(require('../../tests/scope/b').ext).toBe('.ts'); |
195 | 194 | } finally {
|
196 | 195 | compilers.forEach((c) => c.enabled(false));
|
197 | 196 | }
|
198 | 197 |
|
199 |
| - expect(calls).to.deep.equal([ |
| 198 | + expect(calls).toEqual([ |
200 | 199 | join(TEST_DIR, 'scope/a/index.ts'),
|
201 | 200 | join(TEST_DIR, 'scope/b/index.ts'),
|
202 | 201 | ]);
|
203 | 202 |
|
204 | 203 | delete require.cache[moduleTestPath];
|
205 | 204 |
|
206 |
| - expect(() => require(moduleTestPath)).to.throw(); |
| 205 | + expect(() => require(moduleTestPath)).toThrow(); |
207 | 206 | });
|
0 commit comments