Adapt CWD to OBS build environment
The stock patch was taking care of autopkgtest envrionments.
On our OBS, the test was failing with:
[ 172s] # Subtest: should default to process.cwd() if require.main is undefined
[ 172s] not ok 1 - expected '/usr/src/packages/BUILD' to match /(?:.*autopkgtest.*|require-main-filename)/
[ 172s] ---
[ 172s] stack: |
[ 172s] Test.<anonymous> (test.js:34:36)
[ 172s] at:
[ 172s] line: 34
[ 172s] column: 36
[ 172s] file: test.js
[ 172s] function: Test.<anonymous>
[ 172s] type: AssertionError
[ 172s] showDiff: false
[ 172s] actual: /usr/src/packages/BUILD
[ 172s] expected: null
[ 172s] test: should default to process.cwd() if require.main is undefined
[ 172s] source: >
[ 172s] requireMainFilename({}).should.match(/(?:.*autopkgtest.*|require-main-filename)/)
The workaround is to use the 'BUILD' directory as the patter name.
Ideally, a better fix would be to complement the upstream patch with this additonal pattern but none of the conditions added worked. Probably, for someone much versed with javascript should take it up later
Signed-off-by: Ritesh Raj Sarraf ritesh.sarraf@collabora.com
Edited by Ritesh Raj Sarraf