Skip to content

Commit 9267c89

Browse files
author
Naomi Carrigan
authored
fix: skip meta order test when running specific block (freeCodeCamp#47071)
1 parent 4b4e043 commit 9267c89

File tree

1 file changed

+41
-39
lines changed

1 file changed

+41
-39
lines changed

curriculum/test/test-challenges.js

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -263,49 +263,51 @@ function populateTestsForLang({ lang, challenges, meta }) {
263263
const challengeTitles = new ChallengeTitles();
264264
const validateChallenge = challengeSchemaValidator();
265265

266-
describe('Assert meta order', function () {
267-
/** This array can be used to skip a superblock - we'll use this
268-
* when we are working on the new project-based curriculum for
269-
* a superblock (because keeping those challenges in order is
270-
* tricky and needs cleaning up before deploying).
271-
*/
272-
const superBlocksUnderDevelopment = [
273-
'2022/javascript-algorithms-and-data-structures'
274-
];
275-
const superBlocks = new Set([
276-
...Object.values(meta)
277-
.map(el => el.superBlock)
278-
.filter(el => !superBlocksUnderDevelopment.includes(el))
279-
]);
280-
superBlocks.forEach(superBlock => {
281-
const filteredMeta = Object.values(meta)
282-
.filter(el => el.superBlock === superBlock)
283-
.sort((a, b) => a.order - b.order);
284-
if (!filteredMeta.length) {
285-
return;
286-
}
287-
it(`${superBlock} should have the same order in every meta`, function () {
288-
const firstOrder = getSuperOrder(filteredMeta[0].superBlock, {
289-
showNewCurriculum: process.env.SHOW_NEW_CURRICULUM
266+
if (!process.env.npm_config_block) {
267+
describe('Assert meta order', function () {
268+
/** This array can be used to skip a superblock - we'll use this
269+
* when we are working on the new project-based curriculum for
270+
* a superblock (because keeping those challenges in order is
271+
* tricky and needs cleaning up before deploying).
272+
*/
273+
const superBlocksUnderDevelopment = [
274+
'2022/javascript-algorithms-and-data-structures'
275+
];
276+
const superBlocks = new Set([
277+
...Object.values(meta)
278+
.map(el => el.superBlock)
279+
.filter(el => !superBlocksUnderDevelopment.includes(el))
280+
]);
281+
superBlocks.forEach(superBlock => {
282+
const filteredMeta = Object.values(meta)
283+
.filter(el => el.superBlock === superBlock)
284+
.sort((a, b) => a.order - b.order);
285+
if (!filteredMeta.length) {
286+
return;
287+
}
288+
it(`${superBlock} should have the same order in every meta`, function () {
289+
const firstOrder = getSuperOrder(filteredMeta[0].superBlock, {
290+
showNewCurriculum: process.env.SHOW_NEW_CURRICULUM
291+
});
292+
assert.isNumber(firstOrder);
293+
assert.isTrue(
294+
filteredMeta.every(
295+
el =>
296+
getSuperOrder(el.superBlock, {
297+
showNewCurriculum: process.env.SHOW_NEW_CURRICULUM
298+
}) === firstOrder
299+
),
300+
'The superOrder properties are mismatched.'
301+
);
290302
});
291-
assert.isNumber(firstOrder);
292-
assert.isTrue(
293-
filteredMeta.every(
294-
el =>
295-
getSuperOrder(el.superBlock, {
296-
showNewCurriculum: process.env.SHOW_NEW_CURRICULUM
297-
}) === firstOrder
298-
),
299-
'The superOrder properties are mismatched.'
300-
);
301-
});
302-
filteredMeta.forEach((meta, index) => {
303-
it(`${meta.superBlock} ${meta.name} must be in order`, function () {
304-
assert.equal(meta.order, index);
303+
filteredMeta.forEach((meta, index) => {
304+
it(`${meta.superBlock} ${meta.name} must be in order`, function () {
305+
assert.equal(meta.order, index);
306+
});
305307
});
306308
});
307309
});
308-
});
310+
}
309311

310312
describe(`Check challenges (${lang})`, function () {
311313
this.timeout(5000);

0 commit comments

Comments
 (0)