Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Code Quality Assurance
name: Code Quality Assurance - JavaScript/TypeScript

on:
push:
branches: [master]
paths-ignore:
- "core/scripts/APIandLibraries/**"
paths:
- "**/*.js"
- "**/*.ts"
- "**/*.mjs"
- "**/*.html"
- "**/*.css"
- "**/*.json"
- "**/*.xml"
- "**/*.svg"
- "**/*.png"
- "**/*.webp"
- "**/*.ico"
- ".prettierrc"
- ".github/workflows/code-qa-js.yaml"
- "package*.json"
pull_request:
branches: [master]
paths-ignore:
- "core/scripts/APIandLibraries/**"
paths:
- "**/*.js"
- "**/*.ts"
- "**/*.mjs"
- "**/*.html"
- "**/*.css"
- "**/*.json"
- "**/*.xml"
- "**/*.svg"
- "**/*.png"
- "**/*.webp"
- "**/*.ico"
- ".prettierrc"
- ".github/workflows/code-qa-js.yaml"
- "package*.json"

permissions:
contents: read
Expand All @@ -26,13 +49,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -47,4 +70,4 @@ jobs:
- name: Run tests
run: npm run test:jest
- name: Run Playwright tests
run: npx playwright install --with-deps && npm run test:playwright:headless
run: npx playwright install --with-deps && npm run test:e2e:headless
44 changes: 44 additions & 0 deletions .github/workflows/code-qa-markdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Code Quality Assurance - Markdown

on:
push:
branches: [master]
paths:
- "**/*.md"
- ".markdownlint.json"
- ".markdownlintignore"
- ".github/workflows/code-qa-markdown.yaml"
- "package*.json"
pull_request:
branches: [master]
paths:
- "**/*.md"
- ".markdownlint.json"
- ".markdownlintignore"
- ".github/workflows/code-qa-markdown.yaml"
- "package*.json"

permissions:
contents: read
jobs:
lint-markdown:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Run installs
run: npm ci
- name: Run markdownlint on Markdown files
run: npm run lint:markdown
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"MD007": false,
"MD010": false,
"MD013": false,
"MD060": false
}
56 changes: 56 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Markdown to ignore
LICENSE.md

# dependencies
**/node_modules
/.pnp
.pnp.js

# VS code
.vscode/settings.json
.vscode/launch.json

# System Files
.DS_Store

# Coverage and testing
.coverage
/coverage
coverage.html
coverage.out
coverage.xml
cypress/screenshots
cypress/videos

# Playwright
node_modules/
test-results/
playwright-report/
blob-report/
playwright/.cache/
playwright/.auth/
playwright-report/
blob-report/
test-results/

# Packages
core/scripts/APIandLibraries/**/*

# workbox
workbox-config.cjs
core/scripts/serviceWorker

# Visual Studio Code
.vscode/settings.json
.vscode/launch.json

# Data files
.fasta
.xlsx
.csv

# PDFs
.pdf

# Ignore minified files
*.min.*
48 changes: 26 additions & 22 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,35 @@
/.pnp
.pnp.js

# Build files
*.min.js
*.min.css
sw.js
*.js.map

# Packages
core/scripts/APIandLibraries/**/*
# VS code
.vscode/settings.json
.vscode/launch.json

# R data files
.Rproj.user
.Rhistory
.RData
.Ruserdata
# System Files
.DS_Store

# Server files
.htaccess
# Coverage and testing
.coverage
/coverage
coverage.html
coverage.out
coverage.xml
cypress/screenshots
cypress/videos

# Playwright
node_modules/
test-results/
playwright-report/
blob-report/
playwright/.cache/
playwright/.auth/
playwright-report/
blob-report/
test-results/

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.vscode
# Packages
core/scripts/APIandLibraries/**/*

# workbox
workbox-config.cjs
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Bug fix:

## [1.0.0] - 2018-09-20

The official release of SciGrade is here! You can visit it and see all of it in action at https://scigrade.com/ or learn how it works by looking through our EDIT.MD code.
The official release of SciGrade is here! You can visit it and see all of it in action at <https://scigrade.com/> or learn how it works by looking through our EDIT.MD code.

Enjoy learning with CRISPR on SciGrade!
-Alex
Expand Down
26 changes: 13 additions & 13 deletions core/scripts/crispr_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,28 +308,28 @@ function checkAnswers() {
MARgRNAseq = false;
MARgRNAseq_degree = 0;
} else if (
(correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 + 1 &&
correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 + 10) ||
(correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 - 1 &&
correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 - 10)
(correctNucleotidePosition >= possibleAnswer.Position - 1 + 1 &&
correctNucleotidePosition <= possibleAnswer.Position - 1 + 10) ||
(correctNucleotidePosition <= possibleAnswer.Position - 1 - 1 &&
correctNucleotidePosition >= possibleAnswer.Position - 1 - 10)
) {
MARgRNAseq = true;
MARgRNAseq_degree = 1;
true_counts += 1;
} else if (
(correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 &&
correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 + 20) ||
(correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 &&
correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 - 20)
(correctNucleotidePosition >= possibleAnswer.Position - 1 &&
correctNucleotidePosition <= possibleAnswer.Position - 1 + 20) ||
(correctNucleotidePosition <= possibleAnswer.Position - 1 &&
correctNucleotidePosition >= possibleAnswer.Position - 1 - 20)
) {
MARgRNAseq = true;
MARgRNAseq_degree = 2;
true_counts += 1;
} else if (
(correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 &&
correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 + 30) ||
(correctNucleotidePosition <= possible_comparable_answers[i].Position - 1 &&
correctNucleotidePosition >= possible_comparable_answers[i].Position - 1 - 30)
(correctNucleotidePosition >= possibleAnswer.Position - 1 &&
correctNucleotidePosition <= possibleAnswer.Position - 1 + 30) ||
(correctNucleotidePosition <= possibleAnswer.Position - 1 &&
correctNucleotidePosition >= possibleAnswer.Position - 1 - 30)
) {
MARgRNAseq = true;
MARgRNAseq_degree = 3;
Expand All @@ -338,7 +338,7 @@ function checkAnswers() {

// If the sequence if correct, check all other results:
if (MARgRNAseq) {
const temp_answer = element;
const temp_answer = possibleAnswer;
// Check if the cut position matches the answer's input
if (
temp_answer.Position &&
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/crispr_scripts.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions core/scripts/crispr_scripts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ describe("crispr_scripts.js - Utility Functions", () => {
const cases = [
{ name: "short sequence ATCG", input: "ATCG", want: "CGAT" },
{ name: "longer sequence", input: "GCTCGTGACCACCCTGACCT", want: "AGGTCAGGGTGGTCACGAGC" },
{
name: "gRNA sequence from eBFP marking tests",
input: "AAGCACTGCACGCCGTGGGT",
want: "ACCCACGGCGTGCAGTGCTT",
},
{ name: "empty sequence", input: "", want: "" },
{ name: "single nucleotide A", input: "A", want: "T" },
{ name: "single nucleotide T", input: "T", want: "A" },
Expand Down
38 changes: 0 additions & 38 deletions core/scripts/runtime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,6 @@ describe("runtime.js - Runtime Flow Helpers", () => {
});

describe("redirectCRISPR()", () => {
const cases = [
{
name: "clears and repopulates main container",
},
{
name: "calls loadCRISPRJSON_Files before fillGeneList",
},
];

it.each(cases)("$name", async ({ name }) => {
// Execute the ACTUAL imported function
await redirectCRISPR();

// Verify
expect(mockJQuery.empty).toHaveBeenCalled();
expect(global.loadCRISPRJSON_Files).toHaveBeenCalledTimes(1);
expect(global.fillGeneList).toHaveBeenCalledTimes(1);
});

it("ensures DOM elements are properly cleared before population", async () => {
// Execute the ACTUAL imported function
await redirectCRISPR();
Expand Down Expand Up @@ -177,23 +158,4 @@ describe("runtime.js - Runtime Flow Helpers", () => {
expect(executionSequence).toEqual(["empty", "append", "loadCRISPRJSON_Files", "fillGeneList"]);
});
});

describe("Integration: Runtime flow initialization", () => {
it("properly initializes runtime flow when both functions are called", async () => {
mockElement.value = "APOE";
global.checkAnswers_executed = true;
global.document.getElementById.mockReturnValue(mockElement);

// Execute ACTUAL imported functions
await redirectCRISPR();
loadGeneContent();

// Verify complete state
expect(global.possible_gene).toBe("APOE");
expect(global.checkAnswers_executed).toBe(false);
expect(mockJQuery.empty).toHaveBeenCalled();
expect(global.loadCRISPRJSON_Files).toHaveBeenCalled();
expect(global.fillGeneList).toHaveBeenCalled();
});
});
});
Loading