-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
error.t
119 lines (109 loc) · 3.32 KB
/
error.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
Setup
$ . ${TESTDIR}/../_helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)
$ rm -rf .turbo/runs
Use --filter because otherwise we'll get nondeterministic execution summary depending on
whether the other workspaces had finished executing their task yet. We don't care to validate
that behavior in this test.
$ ${TURBO} run maybefails --filter=my-app --summarize > /dev/null 2>&1
[1]
$ source "$TESTDIR/../_helpers/run-summary-utils.sh"
$ SUMMARY=$(/bin/ls .turbo/runs/*.json | head -n1)
Validate that there was a failed task and exitCode is 1 (which is what we get from npm for the failed task)
$ cat $SUMMARY | jq '.execution'
{
"command": "turbo run maybefails --filter=my-app",
"repoPath": "",
"success": 0,
"failed": 1,
"cached": 0,
"attempted": 1,
"startTime": [0-9]+, (re)
"endTime": [0-9]+, (re)
"exitCode": 1
}
Validate that we got a full task summary for the failed task with an error in .execution
$ echo $(getSummaryTaskId $SUMMARY "my-app#maybefails") | jq
{
"taskId": "my-app#maybefails",
"task": "maybefails",
"package": "my-app",
"hash": "c11710f9379cb7ea",
"inputs": {
"package.json": "6bcf57fd6ff30d1a6f40ad8d8d08e8b940fc7e3b"
},
"hashOfExternalDependencies": "ccab0b28617f1f56",
"cache": {
"local": false,
"remote": false,
"status": "MISS",
"timeSaved": 0
},
"command": "exit 4",
"cliArguments": [],
"outputs": null,
"excludedOutputs": null,
"logFile": "apps/my-app/.turbo/turbo-maybefails.log",
"directory": "apps/my-app",
"dependencies": [],
"dependents": [],
"resolvedTaskDefinition": {
"outputs": [],
"cache": true,
"dependsOn": [],
"inputs": [],
"outputMode": "full",
"env": [],
"persistent": false
},
"expandedOutputs": [],
"framework": "",
"envMode": "loose",
"environmentVariables": {
"configured": [],
"inferred": [],
"global": [
"SOME_ENV_VAR=",
"VERCEL_ANALYTICS_ID="
],
"passthrough": null,
"globalPassthrough": null
},
"execution": {
"startTime": [0-9]+, (re)
"endTime": [0-9]+, (re)
"error": "command .* npm run maybefails exited \(1\)", (re)
"exitCode": 1
}
}
With --continue flag. We won't validate the whole thing, just execution
Use --force flag so we can be deterministic about cache hits
Don't use --filter here, so we can validate that both tasks attempted to run
$ rm -rf .turbo/runs
$ ${TURBO} run maybefails --summarize --force --continue > /dev/null 2>&1
[1]
$ source "$TESTDIR/../_helpers/run-summary-utils.sh"
$ SUMMARY=$(/bin/ls .turbo/runs/*.json | head -n1)
success should be 1, and attempted should be 2
$ cat $SUMMARY | jq '.execution'
{
"command": "turbo run maybefails --continue",
"repoPath": "",
"success": 1,
"failed": 1,
"cached": 0,
"attempted": 2,
"startTime": [0-9]+, (re)
"endTime": [0-9]+, (re)
"exitCode": 1
}
$ cat $SUMMARY | jq '.tasks | length'
2
# exitCode is 1, because npm will report all errors with exitCode 1
$ getSummaryTaskId $SUMMARY "my-app#maybefails" | jq '.execution'
{
"startTime": [0-9]+, (re)
"endTime": [0-9]+, (re)
"error": "command .* npm run maybefails exited \(1\)", (re)
"exitCode": 1
}