Commit Graph

94 Commits (52b5bba50123e4f49ad1a9323b287e5c3d73ce5a)

Author SHA1 Message Date
Naomi Carrigan 9267c890bd
fix: skip meta order test when running specific block (#47071) 2022-08-02 16:32:24 +02:00
Ilenia f61b227665
chore: rename project type from bonfire to jsProject (#46823)
* change bonfire in index.js

* change bonfire in build.js

* change bonfire in challenge-types.js

* change bonfire in test-challenges.js

* add jsProject to constants.js
2022-07-11 07:28:29 -05:00
Naomi Carrigan fe71a9cf25
feat: new js cert (#45873)
* chore: move files

* wip: i have no idea what i am doing

* feat: finish up the logic

* chore: use order from randy sheet

* chore: standardise titles

* feat: fix layout for new js projects

* fix: utils test

* fix: challenge tests

* fix: ignore show new curriculum on non-english tests

* chore: help category????

* fix: if these tests would fail locally that'd be great

* chore: duplicate ids
2022-05-16 11:53:45 +02:00
Oliver Eyton-Williams 4cc20172c5
fix: fallback to english challenges (#45635)
* fix: fallback to english challenges

All challenges will use the english version if a translated file is not
available.  SHOW_NEW_CURRICULUM still gates what's shown in the client.

* refactor: use closures to simplify createChallenge

* refactor: remove messy destructure

* refactor: add meta via helper

* fix: fallback to [] for meta.required

* fix: repair challenge.block

* refactor: use CONST_CASE for meta + challenge dirs

* fix: catch empty superblocks immediately

* fix: clean up path.resolves

* fix: invalid syntax in JS project steps

* fix: default to english comments and relax tests

Instead of always throwing errors when a comment is not translated, the
tests now warn while SHOW_UPCOMING_CHANGES is true, so that tests will
pass while we're developing and allow translators time to work.

They still throw when SHOW_UPCOMING_CHANGES is false to catch issues
in production

* test: update createCommentMap test

* refactor: delete stale comment

* refactor: clarify validate with explanatory consts

* feat: throw if audited cert falls back to english

* fix: stop testing upcoming localized curriculum
2022-04-15 09:17:49 -05:00
Oliver Eyton-Williams cde1407f58
feat(client): make all sources available in tests (#44725)
* feat: make all sources available in tests

The original contents of all files (index.html, script.js etc.) will be
accessible in tests.  For example __sources['index.html'] gets the
original html file and nothing else.

* feat: use __file to get user code
2022-02-15 23:29:31 +05:30
Oliver Eyton-Williams cacc4eacd7
fix: handle the sorting of transformed files (#44724)
* fix: handle the sorting of transformed files

We can't use the ext property, since that is transformed, but the
history is maintained.

* test: make solutions polyVinyls for sorting

* refactor: inline prepareChallenge

* refactor: make solutions polys in getChallenges

* fix: convert each solution to a poly

* fix: skip empty solutions

* fix: get challenge file history in client

* refactor: stop calling isPoly from the client

* fix: remove debug console.log

* refactor: remove unnecessary sorting step
2022-01-24 10:42:27 -08:00
Oliver Eyton-Williams b1fb6adc39
fix: insert user html more consistently (#42195)
* fix: use an iframe to preserve head and body

* fix: remove unnecessary parsing of html

The contents gets inserted into the DOM during transformHtml, which
is always part of the build pipeline

* fix: pipe contents through iframe

* refactor: use the same code for both transforms

* fix: try to handle test errors better

Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com>
2022-01-24 18:02:25 +00:00
Oliver Eyton-Williams 87f5cff3cd
fix(client): get jquery from cdn (#44421)
* fix: ensures jquery exists for those challenges

For tests frame-runner.js imports jquery, but jquery challenges always
need it

* Revert "Revert "fix: only include frame-runner when running tests (#44337)" (#44419)"

This reverts commit c19bf504b8.
2022-01-07 10:42:27 +00:00
Oliver Eyton-Williams 36363f277d
test: enable tests for steps (#44550)
* fix: handle missing solutions correctly

Rather than creating an [[]] the parser now creates [] which isEmpty().
This makes the test suite check the next challenge for a solution.

In addition, the logic for testing solutions was fixed.

* chore: update snapshots

* test: build new superblock in node.js-tests CI

* test: allow forward slash in superblock slug

* fix: borked tests oops

* test: ignore duplicated projects

* fix: i did not break these shaun did :)

* fix: idIndex is index of id not id

Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
2021-12-22 12:18:06 -08:00
Oliver Eyton-Williams fd63bb6f85
feat: mvp features for soft launch (#44539)
* refactor: use enum

* feat: create links between legacy and new

* refactor: pull out legacy-links component

* fix: import order

* fix: provide icon for new superblock

* feat: only show the copy on the new superblock

* fix: use the proper i18n keys correctly

* feat: put the new superblock at the end of the map

* feat: update the new superblock title

* test: update for soft launch order

* fix: show original project links on /settings

Soft launch only.

* test: use SHOW_NEW_CURRICULUM in tests

* fix: rename the remaining rwd-22s

* feat: make the messge prettier

* fix: message copy

* refactor: make comment make sense

Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
2021-12-22 16:53:40 +00:00
Nicholas Carrigan (he/him) 8614db7a32
feat: enable new curriculum (#44183)
* feat: use legacy flag

chore: reorder challenges

fix: linter

revert: server change

feat: unblock new editor

fix: proper order

fix: 0-based order

fix: broke the order

feat: move tribute certification to its own block

feat: split the old projects block into 4

fix: put all blocks in order

chore: add intro text

refactor: use block, not blockName in query

fix: project progress indicator

* fix: reorder new challenges/certs

* fix: reorder legacy challenges

* fix: reintroduce legacy certs

* feat: add showNewCurriculum flag to env

* chore: forgot sample.env

* feat: use feature flag for display

* fix: rename meta + dirs to match new blocks

* fix: add new blocks to help-category-map

* fix: update completion-modal for new GQL schema

* test: duplicate title/id errors ->  warnings

* fix: update completion-modal to new GQL schema Mk2

* chore: re-order metas (again)

* fix: revert super-block-intro changes

The intro needs to show both legacy and new content.  We need to decide
which pages are created, rather than than what a page shows when
rendered.

* feat: move upcoming curriculum into own superblock

* fix: handle one certification with two superBlocks

* fix: remove duplicated intros

* fix: remove duplicate projects from /settings

* fix: drop 'two' from Responsive Web Design Two

* chore: rename slug suffix from two to v2

* feat: control display of new curriculum

* feat: control project paths shown on /settings

* fix: use new project order for /settings

This does mean that /settings will change before the release, but I
don't think it's serious.  All the projects are there, just not in the
legacy order.

* fix: claim/show cert button

* chore: remove isLegacy

Since we have legacy superblocks, we don't currently need individual
blocks to be legacy

* test: fix utils.test

* fix: verifyCanClaim needs certification

If Shaun removes the cert claim cards, maybe we can remove this entirely

* fix: add hasEditableBoundaries flags where needed

* chore: remove isUpcomingChange

* chore: v2 -> 22

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-12-20 12:36:31 -06:00
Oliver Eyton-Williams 1642c631de
refactor: drop superorder from metas (#44422)
* refactor: create superOrder from superblock

* chore: drop superOrders from meta

* fix: return null for 'certifications'

* fix: only set superOrder if it is needed

* fix(tests): remove filter from order tests

* test: use getSuperOrder, since superOrder has gone

* test: ignore certificates

* fix: getSuperOrder throw for 'certifications'

* test: remove certificate special case

It wasn't necessary, anyway (it had never been working because I put
certificate not certification)

Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
2021-12-14 08:16:23 -08:00
Oliver Eyton-Williams 9ad29e03d5
refactor: handle certs separately (#44434)
* refactor: split createChallenge into two functions

* refactor: remove certification metas

* fix: remove the metas I missed
2021-12-09 11:53:12 -08:00
Nicholas Carrigan (he/him) c19bf504b8
Revert "fix: only include frame-runner when running tests (#44337)" (#44419)
This reverts commit a23a47750b.
2021-12-08 22:10:41 +05:30
Oliver Eyton-Williams a23a47750b
fix: only include frame-runner when running tests (#44337)
* fix: only include frame-runner when running tests

* fix: handle missing options

* test: use test runner for curriculum tests
2021-12-06 13:02:49 -06:00
Nicholas Carrigan (he/him) 8372623f69
chore(curriculum): fix + test curriculum order (#44366)
* chore(tools): test curriculum order

* chore: update orders

* fix(tests): temporarily ignore cert super

The Relational Databases cert being 'upcomingChanges' is breaking
the tests.

* fix: graphql query here

* fix: use only one meta

* chore: remove unnecessary superOrders

* chore: zero-based indexing

* fix: update mock

* refactor: remove unused fixture

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-12-06 16:55:13 +00:00
Oliver Eyton-Williams f613a1e5fd
fix: index.css/js to styles/script (#44356)
* fix: replace index with script/styles as needed

* fix: remove redundant fileKey

It's overwritten by createPoly, so the parser does not need to create it

* fix: curriculum test suite

* Update client/src/templates/Challenges/classic/MultifileEditor.js

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-12-03 12:32:29 -08:00
Oliver Eyton-Williams e139fbcf13 test: update *test* grammar
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-10-27 21:29:05 +05:30
Oliver Eyton-Williams 8538141600 fix: grammar
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-10-27 21:29:05 +05:30
Oliver Eyton-Williams f6999fa8bb test: extract-js-comments error 2021-10-27 21:29:05 +05:30
Oliver Eyton-Williams 3e5cffba0f fix: throw better error when JS parse fails
This should help debugging challenges with invalid syntax.
2021-10-27 21:29:05 +05:30
Nicholas Carrigan (he/him) b36cdbafd1
chore: rename "part" to "step" (#43934)
* chore: rename part to step

* chore: update metas

* chore: more renaming

* chore: update tooling

* chore: update frontmatter

* chore(tools): title testing
2021-10-21 18:07:52 +01:00
Eric Cheng 2ba536d559
refactor: enforce consistent camelCase in const names, add comments, condense multiple single-line comments into one multi-line comment (#43699) 2021-10-04 19:15:44 +05:30
Oliver Eyton-Williams e4ba0e23ea
feat: enable reset in multifile editor (#43617)
* feat: dispatch resetChallenge action

* fix: copy challengeFiles instead of in-place sort

* fix: handle null updateFile payloads in redux

* refactor: reorganise region initialization

* refactor: pull code into editorDidMount

Then we can rely on the presence of the editor and monaco and don't have
litter the code with null checks.

* refactor: use better name for editable region init

* refactor: remove unused decoration

* refactor: rename forbidden region init functions

* fix: keep all challengeFiles when resetting

* refactor: remove unused decoration class

* fix: reinitialize editor on reset

* fix: stop adding multiple scroll listeners

Since the challengeFile update on each keystroke extra (unnecessary)
adding of listeners slowed the editor to a crawl.

* fix: only scroll to editor on mount

Rather than on any edit.

* refactor: remove logs and comments

* fix: rename toSortedArray and fix broken test

* fix: check for null not falsy in updateFile

* fix: only update project features when project

* fix: only reset if editor contents have changed

* feat: focus on editor after reset
2021-10-01 10:36:20 +02:00
Shaun Hamilton 59f17f237b
refactor: files{} -> challengeFiles[], and key -> fileKey (#43023)
* fix(client): fix client

* fix propType and add comment

* revert user.json prettification

* slight type refactor and payload correction

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* update ChallengeFile type imports

* add cypress test for code-storage

* update test and storage epic

* fix Shaun's tired brain's logic

* refactor with suggestions

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* update codeReset

* increate cypress timeout because firefox is slow

* remove unused import to make linter happy

* use focus on editor

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* use more specific seletor for cypress editor test

* account for silly null challengeFiles

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-08-12 20:48:28 +02:00
awu43 dd5d2919be
feat(client): ts-migrate client/utils/** (#42823)
* rename js files

* update imports and references

* migrate build-challenges

* migrate challenge-types

* migrate utils/index

* migrate state-management

* install @types/psl for tags

* migrate tags

* migrate tags.test

* migrate challenge-page-creator

* migrate utils/gatsby/index

* migrate layout-selector

* migrate layout-selector.test

* revert challenge-types

Curriculum can't handle TS or modules

* convert arrow functions

* revert build-challenges

* revert utils/gatsby/index

* revert challenge-page-creator

* revert challenge-types reference

* Delete state-management

Deleted in #42960

* Disable render-result-naming-convention (for now)

* update layout-selector.test comment

* reorder imports in build-challenges

* change ts-ignore to ts-expect-error
2021-08-09 10:30:31 +02:00
Oliver Eyton-Williams e118dda13a
fix: order imports and remove circular dependencies (#41824)
* fix: remove circular dependency

redux depended on templates/Challenges/redux and vice versa.  This
meant that import order mattered and confusing bugs could arise.

(cherry picked from commit 7d67a4e70922bbb3051f2f9982dcc69e240d43dc)

* feat: require imports to be in alphabetical order

Import order generally does not matter, but there are edge cases
(circular  imports and css imports, for example) where changing order
changes behaviour

(cherry picked from commit b8d1393a91ec6e068caf8e8498a5c95df68c2b2c)

* chore: order imports

* fix: lift up challenge description + title comps

This brings the classic Show closer to the others as they
now all create the description and title components

* fix: remove donation-saga/index circular import

(cherry picked from commit 51a44ca668a700786d2744feffeae4fdba5fd207)

* refactor: extract action-types from settings

(cherry picked from commit 25e26124d691c84a0d0827d41dafb761c686fadd)

* fix: lint errors

* feat: prevent useless renames
2021-08-02 08:39:40 -05:00
Huyen Nguyen 2c16234853
chore: add jest global variables (#42573) 2021-06-20 09:14:42 +02:00
Mrugesh Mohapatra a378bc6dd4
chore: rework the language audits for build (#42510)
This also reverts commit cd5c28b332.
2021-06-15 23:07:52 +05:30
Nicholas Carrigan (he/him) cd5c28b332
revert: disable portuguese (#42508)
* revert: disable portuguese

First certification is not 100% yet. Shipped too soon. :(

* feat: enable portuguese curriculum

Curriculum can build in portuguese, leaving client disabled to
prevent language from appearing in nav bar.

* feat: move audited cert list

Moves the audited cert list to the config, instead of the utils.
2021-06-15 21:32:29 +05:30
Oliver Eyton-Williams 66dae77fc5
feat: use TypeScript in the client (#42124) 2021-05-18 00:23:41 +05:30
renovate[bot] 21dd80c47a
chore(deps): update dependency prettier to v2.3.0 (#42074)
* chore(deps): update dependency prettier to v2.3.0

* chore: apply formating per prettier

* fix: correctly disable import/no-unresolved

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Mrugesh Mohapatra <hi@mrugesh.dev>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-05-10 08:48:49 -07:00
Oliver Eyton-Williams be19823422 chore(deps): update joi and joi-objectid 2021-05-05 18:12:50 +05:30
Oliver Eyton-Williams 2eac236e39
fix: remove JS comments revisited (#41952)
* fix: restrict removeJSComments to test-evaluator

To prevent @babel from being included everywhere, this only calls
removeJSComments inside the test-evaluator

* test: add removeJSComments test
2021-04-30 22:30:06 +03:00
Oliver Eyton-Williams 9be2fb9a10
fix: use lodash-es in the client (#41931) 2021-04-28 16:11:20 -05:00
Evgeny Klimenchenko db369fbed1
fix(client): remove JS comments from user code for tests (#41873)
* Removes comments in js challanges by default

* fix local-scope-and-functions test regex

* fix all languages

* revert language changes

* removed unnecessary removeJSComments from challenges

* fix challanges in other languages

* removed removeJSComments from all challanges
2021-04-28 10:18:54 -05:00
Mrugesh Mohapatra ad9b1f89d8
fix(api, client): update Gatsby, webpack & related things (#41452)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-03-25 12:13:43 -07:00
Oliver Eyton-Williams 0d3158d4f4
fix(tests): add validation of comment translations (#41537) 2021-03-20 11:59:13 +05:30
Mrugesh Mohapatra 6c91f81b0e chore(deps): upgrade eslint, prettier & related packages 2021-03-11 12:19:42 +05:30
Oliver Eyton-Williams f4e1fe11fc
fix: error reporting (#41249) 2021-02-25 20:09:28 +05:30
Oliver Eyton-Williams f8699a8d55
refactor: simplify challenge.block usage (#41185) 2021-02-23 09:52:48 +05:30
Oliver Eyton-Williams 2c7efe50fd fix: disable linting for webpack generated file 2021-02-03 22:26:36 +05:30
Oliver Eyton-Williams fffc0e51ec
chore(client): refactor & organise config (#40875) 2021-02-03 15:22:07 +05:30
Oliver Eyton-Williams 94e6219c39 fix(test): longer test timeout (#40748)
Some tests randomly fail in CI so this commit makes them more forgiving.
2021-01-31 12:15:39 +05:30
Oliver Eyton-Williams e4a9b2988c
feat: update Ask for help (#40114)
* feat: get helpCategory from frontmatter

* DEBUG: sets all the projects to JavaScript

This is just so the tests pass, it'll need to go.

* fix: updated helpCategoryMap categories

* fix: added Python to helpCategory frontmatter key

Co-authored-by: Randell Dawson <rdawson@onepathtech.com>
2020-10-30 14:10:34 -05:00
Oliver Eyton-Williams 0caa2fe782 fix: only test audited certificates 2020-10-22 03:18:16 +05:30
Oliver Eyton-Williams 793fa8fb52 test: check replaced iff translatable comment
All translatable comments should be replaced, but nothing else.
2020-10-22 03:18:13 +05:30
Oliver Eyton-Williams 3e00167ba4
chore(curriculum): replace validator with Joi (#39959)
We only used validator in one place and Joi could do the same job.
2020-10-13 17:25:24 +05:30
Oliver Eyton-Williams 1b895e7809 fix: translate title and dashName correctly 2020-10-06 23:10:08 +05:30
Oliver Eyton-Williams 9df098953d Feat: editable dom element (#39341)
* feat: __testEditable allows editable region tests

It's not entirely isolated, but it makes it possible to select only the
element with id 'editable-only' which is built solely from code inside
the editable region.

* fix(client): missing editableContents -> ''

Previously it was added as the string 'undefined'

* fix: more informative error messages

* fix: DRY, correct and test getLines
2020-09-16 11:54:11 +05:30