Skip to content

Commit c28ae72

Browse files
Ugzuzgblumamir
andauthored
test(cucumber): join all paths with path module (open-telemetry#2694)
Co-authored-by: Amir Blum <[email protected]>
1 parent ce62d8c commit c28ae72

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

plugins/node/instrumentation-cucumber/test/cucumber.test.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,23 @@ describe('CucumberInstrumentation', () => {
8484
providedConfiguration?: Partial<IConfiguration>
8585
) => {
8686
// clean-up require cache to re-register cucumber hooks for a new run
87-
['features/support/world', 'features/step_definitions/steps'].forEach(
88-
search => {
89-
const key = Object.keys(require.cache).find(key =>
90-
key.includes(search)
91-
);
92-
if (key == null) return;
93-
delete require.cache[key];
94-
}
95-
);
87+
[
88+
path.join('features', 'support', 'world'),
89+
path.join('features', 'step_definitions', 'steps'),
90+
].forEach(search => {
91+
const key = Object.keys(require.cache).find(key => key.includes(search));
92+
if (key == null) return;
93+
delete require.cache[key];
94+
});
9695
const featurePath = path.join(__dirname, 'current.feature');
9796
await fs.promises.writeFile(featurePath, feature, 'utf-8');
9897
const { runConfiguration } = await loadConfiguration({
9998
provided: {
10099
...providedConfiguration,
101100
paths: [featurePath],
102101
require: [
103-
path.join(__dirname, 'features/support/world.ts'),
104-
path.join(__dirname, 'features/step_definitions/steps.ts'),
102+
path.join(__dirname, 'features', 'support', 'world.ts'),
103+
path.join(__dirname, 'features', 'step_definitions', 'steps.ts'),
105104
],
106105
},
107106
});
@@ -170,7 +169,7 @@ describe('CucumberInstrumentation', () => {
170169
assert(parent, 'Expected a parent span');
171170

172171
assert.deepEqual(parent.attributes, {
173-
[SEMATTRS_CODE_FILEPATH]: 'test/current.feature',
172+
[SEMATTRS_CODE_FILEPATH]: path.join('test', 'current.feature'),
174173
[SEMATTRS_CODE_LINENO]: 7,
175174
[SEMATTRS_CODE_FUNCTION]: 'Button pushing',
176175
[SEMATTRS_CODE_NAMESPACE]: 'Basic',

0 commit comments

Comments
 (0)