JS Lasagna test help

i’m trying to do some exercises in javascript but when I send the code the whole site crashes

What exactly are you seeing? The site seems to be working fine for me so the whole site is not crashed ;)

when i click to run tests, the whole site freeze, i’m doing the exercise lasagna

When you click run tests, it runs the tests in your browser tab. Things running in your browser isn’t the same as “the whole Exercism website” :slight_smile:

Does it freeze for a second or two? Or for much longer? Can you share the code you’re testing? (Please use codeblocks. Please do not use screenshots/images to share code.)

when i click run tests I can’t click with the mouse on anything anymore and i can’t open the development tools or copy the code, i have to reload the page and yet when I click on run tests nothing works

// @ts-check
//
// ☝🏽 The line above enables type checking for this file. Various IDEs interpret
// the @ts-check directive. It will give you helpful autocompletion on the web
// and supported IDEs when implementing this exercise. You don't need to
// understand types, JSDoc, or TypeScript in order to complete this JavaScript
// exercise, and can completely ignore this comment block and directive.

// 👋🏽 Hi there!
//
// On the JavaScript track we provide you with stubs. These stubs provide a
// starting point to solving the exercise.
//
// In general, each variable/constant and each declared function will have a
// JSDoc comment block above it, explaining what the variable/constant holds or
// the function is supposed to accomplish.
//
// 💡 Often, the JSDoc comment blocks have annotations, such as @param and
// @returns which are usually highlighted with a different color if the IDE
// you're in recognizes them. It's these annotations that are used when
// referring to the constant, variable, or function from somewhere else that
// IDEs display.
//
// You don't need to write these yourself; it is not expected in idiomatic
// JavaScript, but some companies and style-guides do enforce them.
//
// 💡 You're allowed to completely clear a stub before you get started. Often
// we recommend using the stub, because they are already set-up correctly to
// work with the tests, which you can find in ./lasagna.spec.js
//
// Good luck preparing some lasagna!

/**
 * The number of minutes it takes to prepare a single layer. // o tempo que vai levar para preparar cada camada da lasanha
 */

import { EXPECTEC_MINUTES_IN_OVEN } from './lasagna.js';

const PREPARATION_MINUTES_PER_LAYER = 2;
export const EXPECTED_MINUTES_IN_OVEN = 40;

/**
 * Determines the number of minutes the lasagna still needs to remain in the
 * oven to be properly prepared. // determine os minutos que a lasanha ainda precisa ficar no forno para ficar devidamente preparada
 *
 * @param {number} actualMinutesInOven
 * @returns {number} the number of minutes remaining
 */

// traduções - remainingMinutesInOven (minutos restantes no forno) / actualMinutesInOven (minutos atuais no forno)

export function remainingMinutesInOven(actualMinutesInOven) {
  return (EXPECTEC_MINUTES_IN_OVEN - actualMinutesInOven);
}

remainingMinutesInOven(25);

/**
 * Given a number of layers, determines the total preparation time. // defina um número de camadas e determine o tempo total de preparação
 *
 * @param {number} numberOfLayers
 * @returns {number} the total preparation time
 */
export function preparationTimeInMinutes(numberOfLayers) {
  return (numberOfLayers * PREPARATION_MINUTES_PER_LAYER);
}

preparationTimeInMinutes(15);

/**
 * Calculates the total working time. That is, the time to prepare all the layers
 * of lasagna, and the time already spent in the oven. // calcule o tempo total de preparação, esse é o tempo de preparo de todas as camadas e o tempo já passado no forno
 *
 * @param {number} numberOfLayers
 * @param {number} actualMinutesInOven
 * @returns {number} the total working time
 */
export function totalTimeInMinutes(numberOfLayers, actualMinutesInOven) {
  return preparationTimeInMinutes(numberOfLayers) + actualMinutesInOven;
}

totalTimeInMinutes();

I think you may have a recursive import ;) This line tells the file to read itself. When it reads itself it gets to that line and tries to read itself. Loop forever.

1 Like

so I don’t need to import the constant?

Correct. The instructions never tell you to import anything. You define the constant.

2 Likes

cc @SleeplessByte - we should probably guard this :slight_smile:

2 Likes

omg now I understand, sorry for the confusion, I’m new to programming and thank you for explain!!