| 95 | } |
| 96 | |
| 97 | const teardown = () => { |
| 98 | const cwd = process.cwd() |
| 99 | if (!cwd.startsWith(initialWorkingDir)) { |
| 100 | throw new Error(`Somehow cd'd into ${cwd}`) |
| 101 | } |
| 102 | if (cwd != initialWorkingDir) { |
| 103 | ;[ |
| 104 | 'puck', |
| 105 | 'puck2', |
| 106 | 'puck3', |
| 107 | 'node_modules', |
| 108 | '.serverless', |
| 109 | '.requirements.zip', |
| 110 | '.requirements-cache', |
| 111 | 'foobar', |
| 112 | 'package-lock.json', |
| 113 | 'slimPatterns.yml', |
| 114 | 'serverless.yml.bak', |
| 115 | 'module1/foobar', |
| 116 | getUserCachePath(), |
| 117 | ...globSync('serverless-python-requirements-*.tgz'), |
| 118 | ].map((path) => removeSync(path)) |
| 119 | if (!cwd.endsWith('base with a space')) { |
| 120 | try { |
| 121 | git(['checkout', 'serverless.yml']) |
| 122 | } catch (err) { |
| 123 | console.error( |
| 124 | `At ${cwd} failed to checkout 'serverless.yml' with ${err}.`, |
| 125 | ) |
| 126 | throw err |
| 127 | } |
| 128 | } |
| 129 | process.chdir(initialWorkingDir) |
| 130 | } |
| 131 | removeSync('tests/base with a space') |
| 132 | } |
| 133 | |
| 134 | const testFilter = (() => { |
| 135 | const elems = process.argv.slice(2) // skip ['node', 'test.js'] |