我有一个想要添加持续集成的 TypeScript 和 react 应用程序,因此我在“设置”下启用了我的管道。
当我提交到我的主分支时,为 heroku 应用程序构建成功,但测试失败,见(pipeline name) > Tests
. 我在下面包含了两者的日志。您可以对它们进行比较,发现它们几乎完全相同,只是测试必须自动检测 buildpack、纱线缓存和一些环境变量。
这些是否可能导致构建失败?我的测试应该有什么不同?
production succeeds
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.16.0...
Using default npm version: 6.14.11
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.10)
Installed yarn 1.22.10
-----> Restoring cache
- yarn cache
-----> Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 10.02s.
-----> Build
Running heroku-postbuild (yarn)
yarn run v1.22.10
$ yarn compile-tsc && cd client && yarn && yarn run build
$ tsc
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
127.33 KB build/static/js/2.a700b678.chunk.js
1.88 KB build/static/js/main.24b36bd5.chunk.js
773 B build/static/js/runtime-main.900dd88b.js
547 B build/static/css/main.68ae183e.chunk.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
Done in 80.63s.
tests fail
-----> Building on the Heroku-20 stack
-----> Auto detecting buildpacks...
buildpack detected
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_PRODUCTION=false
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_VERBOSE=false
NODE_ENV=test
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.16.0...
Using default npm version: 6.14.11
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.10)
Installed yarn 1.22.10
-----> Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 38.82s.
-----> Build
Running heroku-postbuild (yarn)
yarn run v1.22.10
$ yarn compile-tsc && cd client && yarn && yarn run build
$ tsc
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ react-scripts build
Creating an optimized production build...
Failed to compile.
src/App.tsx
Syntax error: Unexpected token (21:9)
> 21 | lobbyId!: string;
| ^
src/models-shared.ts
Syntax error: Unexpected token, expected "{" (5:8)
3 | import cookie from 'react-cookies'
4 |
> 5 | export namespace Const
| ^
6 | {
7 | export const UniqueIdLength = 8;