MCPcopy
hub / github.com/serverless/serverless / teardown

Function teardown

packages/sf-core/tests/python/test.js:97–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95}
96
97const 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
134const testFilter = (() => {
135 const elems = process.argv.slice(2) // skip ['node', 'test.js']

Callers 1

testFunction · 0.85

Calls 2

errorMethod · 0.80
getUserCachePathFunction · 0.70

Tested by 1

testFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…