File tree 3 files changed +15
-6
lines changed
packages/remix/test/integration
3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 1
1
const baseConfig = require ( '../../jest.config.js' ) ;
2
2
3
3
module . exports = {
4
- globalSetup : '<rootDir>/test/server/utils/run-server.ts' ,
4
+ globalSetup : '<rootDir>/test/server/utils/test-setup.ts' ,
5
+ globalTeardown : '<rootDir>/test/server/utils/test-teardown.ts' ,
5
6
...baseConfig ,
6
7
testMatch : [ '**/*.test.ts' ] ,
7
8
} ;
Original file line number Diff line number Diff line change 1
- import express , { Express } from 'express' ;
1
+ import express from 'express' ;
2
2
import { createRequestHandler } from '@remix-run/express' ;
3
+ import { Server } from 'http' ;
4
+
5
+ declare global {
6
+ var __REMIX_SERVER__ : Server ;
7
+ }
3
8
4
9
/**
5
10
* Runs a test server
6
11
*/
7
- function runServer ( testDir : string ) : void {
12
+ function runServer ( ) : void {
8
13
const app = express ( ) ;
9
14
10
15
app . all ( '*' , createRequestHandler ( { build : require ( '../../../build' ) } ) ) ;
11
16
12
- app . listen ( 3000 ) ;
13
-
14
- // TODO: Finish app after tests
17
+ globalThis . __REMIX_SERVER__ = app . listen ( 3000 ) ;
15
18
}
16
19
17
20
export default runServer ;
Original file line number Diff line number Diff line change
1
+ function exitServer ( ) : void {
2
+ globalThis . __REMIX_SERVER__ . close ( ) ;
3
+ }
4
+
5
+ export default exitServer ;
You can’t perform that action at this time.
0 commit comments