Skip to content

Commit ccade59

Browse files
committed
har fixes
1 parent 3b5bc44 commit ccade59

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

Dockerfile.cli

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# docker build -f Dockerfile.cli -t my-cli .
2-
# docker run -e CONFIG_FILE=/app/config.yaml -e AUTH_HEADER="Bearer CdVrlXiAtgubUkpkS14KUdSN6K4Kx8tkppjtvaWOHVJIzbo3heh0w7OY30DD" -e BASE_URL="https://api.scim.dev/scim/v2" -v $(pwd)/site/.vitepress/theme/components/config.yaml:/app/config.yaml my-cli
2+
# docker run -e CONFIG_FILE=/app/config.yaml -e AUTH_HEADER="Bearer JdwETA7axAMc6AK35KYRclJDaoDkkRo4BaQtUnZZBvh1BqZ5RPSBZdA18ydD" -e BASE_URL="https://api.scim.dev/scim/v2" -e HAR_FILE_NAME="/output/output.har" -v $(pwd)/site/.vitepress/theme/components/config.yaml:/app/config.yaml -v $(pwd)/output/:/output my-cli
33

4-
FROM node:20-alpine
4+
FROM node:21-alpine
55

66
WORKDIR /app
77

@@ -15,4 +15,5 @@ RUN npm ci --only=production
1515
COPY . .
1616

1717
# Set the entrypoint
18-
ENTRYPOINT ["node", "--test", "--test-reporter=./test/reporters/clean-spec.js"]
18+
ENTRYPOINT ["node", "--test"]
19+
CMD ["--test-reporter=spec"]

scim.test.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import axios from 'axios';
3-
import { getAxiosInstance, writeHarFile } from './src/helpers.js';
3+
import { getAxiosInstance, writeHarFile, clearHarEntries } from './src/helpers.js';
44

55
import runBasicTests from './src/basics.js';
66
import runUserTests from './src/users.js';
@@ -120,5 +120,18 @@ runAllTests(
120120
console.error('Error running tests:', error);
121121
process.exit(1);
122122
}).finally(() => {
123-
writeHarFile('scim');
123+
if(process.env.HAR_FILE_NAME) {
124+
// Make sure the HAR file has the correct extension
125+
let harFileName = process.env.HAR_FILE_NAME;
126+
if (!harFileName.toLowerCase().endsWith('.har')) {
127+
harFileName += '.har';
128+
}
129+
130+
console.log('Writing HAR file:', harFileName);
131+
132+
writeHarFile(harFileName);
133+
}
134+
135+
clearHarEntries();
136+
124137
});

src/groups.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
251251

252252
if (configuration?.groups?.operations?.includes('DELETE')) {
253253
for (const [index, deletion] of (configuration.groups.delete_tests || []).entries()) {
254-
test(`Deletes a group - Alternative ${index + 1}`, async (t) => {
254+
await test(`Deletes a group - Alternative ${index + 1}`, async (t) => {
255255
const testAxios = getAxiosInstance(configuration, t);
256256

257257
const deleteId = !deletion.id || deletion.id === 'AUTO' ? sharedState.createdGroup?.id : deletion.id;

src/helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ export function writeHarFile(testName) {
6969
}
7070
};
7171

72-
const harPath = path.join(process.cwd(), `${testName}.har`);
72+
const harPath = testName;
7373
fs.writeFileSync(harPath, JSON.stringify(har, null, 2));
7474
harEntries = []; // Clear entries after writing
7575
}
7676

77+
export function clearHarEntries() {
78+
harEntries = [];
79+
}
80+
7781
/**
7882
*
7983
* @param {*} config

0 commit comments

Comments
 (0)