Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit c0967c8

Browse files
build: enable windows in travis (#42)
* build: enable windows in travis * build: replace npm install --prefix with plain cd in travis.yml * fix: handle termination of child_process for windows differently * test: move spawn outside of promise
1 parent 5b22b3c commit c0967c8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sudo: false
22
os:
3-
# - windows
3+
- windows
44
- linux
55
- osx
66
language: node_js
@@ -9,7 +9,7 @@ node_js:
99
- "11.10"
1010
install:
1111
- npm install
12-
- npm install --prefix integration/app-with-serverless-offline
12+
- cd integration/app-with-serverless-offline && npm install && cd ../../
1313
script:
1414
- npm run lint
1515
- npm test

integration/__tests__/local-deploy.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const execSync = require("child_process").execSync;
12
const path = require("path");
23
const serverlessOfflineStart = require("../../utils/test/serverlessOfflineStart");
34
const httpGet = require("../../utils/test/httpGet");
@@ -13,7 +14,11 @@ describe("Local Deployment Tests (via serverless-offline)", () => {
1314
});
1415

1516
afterAll(() => {
16-
slsOffline.kill();
17+
if (process.platform === "win32") {
18+
execSync(`taskkill /pid ${slsOffline.pid} /f /t`);
19+
} else {
20+
slsOffline.kill();
21+
}
1722
});
1823

1924
it("should render the index page", () => {

utils/test/serverlessOfflineStart.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const serverlessExec = require("./getServerlessExec");
44
const bufferToStr = buffer => Buffer.from(buffer).toString("utf8");
55

66
module.exports = () => {
7-
return new Promise((resolve, reject) => {
8-
const serverlessOffline = spawn(serverlessExec, ["offline"]);
7+
const serverlessOffline = spawn(serverlessExec, ["offline"]);
98

9+
return new Promise((resolve, reject) => {
1010
serverlessOffline.stdout.on("data", data => {
1111
const stdoutStr = bufferToStr(data);
1212

0 commit comments

Comments
 (0)