Skip to content
Open
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
76 changes: 34 additions & 42 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
env: {
browser: true,
es6: true,
node: true, // Añade soporte para Node.js (para module.exports, require, process)
'jest/globals': true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
extends: [
'eslint:recommended',
'plugin:react/recommended'
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
parserOptions: {
ecmaFeatures: {
jsx: true
},
"ecmaVersion": 2018,
"sourceType": "module"
ecmaVersion: 2018,
sourceType: 'module'
},
"plugins": [
"react", "jest"
plugins: [
'react',
'jest'
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
],
"eqeqeq": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": [
"error", "always"
],
"arrow-spacing": [
"error", { "before": true, "after": true }
],
"no-console": "error",
"react/prop-types": 0
settings: {
react: {
version: 'detect'
}
},
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never'],
eqeqeq: 'error',
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
'no-console': 'error',
'react/prop-types': 0,
'no-undef': 'error' // Asegura que no-undef esté habilitado
}
}
}
17 changes: 17 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Hello World # Nombre del workflow (opcional, pero recomendado)

on: # Define cuándo se ejecuta el workflow
push:
branches: [ main ] # Se activa en pushes a la rama 'main'

jobs: # Define los jobs (tareas) del workflow
build: # Nombre del job (puede ser cualquier cosa)
runs-on: ubuntu-latest # Entorno de ejecución (máquina virtual)

steps: # Pasos dentro del job
- name: Print Hello World # Nombre del paso (opcional)
run: echo "Hello World!" # Comando a ejecutar (aquí usamos 'echo')
- name: Now it is
run: date
- name: Directory content
run: ls -l
34 changes: 34 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deployment pipeline

on:
push:
branches:
- main
pull_request:
branches: [main]
types: [opened, synchronize]


jobs:
simple_deployment_pipeline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Check style
run: npm run eslint
- name: Build project
run: npm run build
- name: Run tests
run: npm test
- name: e2e tests
uses: cypress-io/github-action@v5
with:
command: npm run test:e2e
start: npm run start-prod
wait-on: http://localhost:5000
12 changes: 6 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const express = require("express");
const app = express();
const express = require('express')
const app = express()

// get the port from env variable
const PORT = process.env.PORT || 5000;
const PORT = process.env.PORT || 5000

app.use(express.static("dist"));
app.use(express.static('dist'))

app.listen(PORT, () => {
console.log(`server started on port ${PORT}`);
});
// console.log(`server started on port ${PORT}`)
})
8 changes: 8 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents: null,

},
})
5 changes: 5 additions & 0 deletions cypress/e2e/pokedex-copy-1.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('template spec', () => {
it('passes', () => {
cy.visit('https://example.cypress.io')
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/pokedex.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('Pokedex', function() {
it('front page can be opened', function() {
cy.visit('http://localhost:5000')
cy.contains('ivysaur')
cy.contains('Pokémon and Pokémon character names are trademarks of Nintendo.')
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
Empty file added eslint
Empty file.
Empty file added fullstackopen-cicd@1.0.0
Empty file.
Loading