0Pricing
JavaScript Academy · Lesson

CI basics — run lint/test on every push

Set up a tiny CI: install with npm ci, run lint and tests, and keep a fast feedback loop.

CI basics — run lint/test on every push is a free JavaScript Academy lesson on CoddyKit — lesson 3 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the JavaScript Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why CI for beginners?

Goal: Run checks on every push.

  • Install with npm ci
  • Run lint and test scripts
  • Fast feedback, simple logs
  • Keep pipeline tiny for beginners
CI basics — run lint/test on every push — illustration 1

Scripts CI will run

Create tiny lint and test scripts in package.json so CI can run them.

// Minimal scripts your CI will call
const pkgScripts = {
  lint: "eslint .",
  test: "node test-runner.js"
};

console.log("scripts:", Object.keys(pkgScripts));
console.log("lint ->", pkgScripts.lint);
console.log("test ->", pkgScripts.test);
CI basics — run lint/test on every push — illustration 2

Pipeline steps

A tiny pipeline: checkout → Node → npm cilinttest → result.

// Simulate CI steps with prints
function runCI() {
  console.log("🔹 Checkout code");
  console.log("🔹 Use Node 20");
  console.log("🔹 Install deps with npm ci");
  console.log("🔹 Run: npm run lint");
  console.log("🔹 Run: npm test");
  console.log("✅ If all pass, mark build green");
}

runCI();
CI basics — run lint/test on every push — illustration 3

GH Actions (minimal)

This tiny workflow runs on pushes and PRs, installs with npm ci, then runs lint and test.

// Print a minimal GitHub Actions workflow (as lines)
const gha = [
  "name: ci",
  "on: [push, pull_request]",
  "jobs:",
  "  build:",
  "    runs-on: ubuntu-latest",
  "    steps:",
  "      - uses: actions/checkout@v4",
  "      - uses: actions/setup-node@v4",
  "        with:",
  "          node-version: 20",
  "      - run: npm ci",
  "      - run: npm run lint",
  "      - run: npm test"
];

for (const l of gha) console.log(l);
CI basics — run lint/test on every push — illustration 4

Speed & clarity

Short tests and clear output keep CI friendly for beginners; add more steps later.

// Keep CI snappy: small tests, small logs
function ciTips() {
  console.log("• Keep tests small and fast");
  console.log("• Fail early; print clear messages");
  console.log("• Cache deps (advanced later)");
  console.log("• Lint + unit tests first; more later");
}
ciTips();
CI basics — run lint/test on every push — illustration 5

Tests the CI can run

Your npm test can run a tiny script at first; switch to Jest/Vitest later.

// A tiny local test runner you can call in CI
function assertEqual(actual, expected, name) {
  if (actual === expected) console.log("✅", name);
  else console.log("❌", name, "expected:", expected, "got:", actual);
}

function add(a, b) { return a + b; }
assertEqual(add(2, 3), 5, "add adds numbers");

function isAdult(age) { return age >= 18; }
assertEqual(isAdult(18), true, "adult boundary");
CI basics — run lint/test on every push — illustration 6

CI install command quiz

Quick check: Lockfile-respecting install in CI.

CI basics — run lint/test on every push — illustration 7

Recap

Recap: CI runs on each push: npm cilinttest. Keep checks tiny and clear so beginners get fast feedback.

CI basics — run lint/test on every push — illustration 8

Frequently asked questions

Is the “CI basics — run lint/test on every push” lesson free?

Yes — the full text of “CI basics — run lint/test on every push” is free to read here on the web, and the JavaScript Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the JavaScript Academy course, upgrade to CoddyKit PRO.

What will I learn in “CI basics — run lint/test on every push”?

Set up a tiny CI: install with npm ci, run lint and tests, and keep a fast feedback loop. You practise JavaScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start JavaScript Academy?

No prior experience is required. JavaScript Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 3, so you can start here or from the beginning and move at your own pace.

How long does the “CI basics — run lint/test on every push” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this JavaScript Academy lesson?

Yes. Every JavaScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Test mindset — tiny assertions, AAA, red→green→refactor
  2. Linting with ESLint; Prettier formatting
  3. CI basics — run lint/test on every push
← Back to JavaScript Academy